<template>
	<view>
		<view class="top">
			<view class="top_avatar
">
				<view class="user-info-box" style="flex: 1;display: flex;">
					<view class="portrait-box">
						<image class="portrait" src="/static/missing-face.png" style="width: 112rpx;height: 112rpx;"></image>
					</view>
					<view class="info-box" style="line-height: 50rpx;padding-top: 28rpx;color: #fff;padding-left: 20rpx;">
						<text class="username">1积分</text>
					</view>
				</view>
				<view class="illustrate
">
					®积分说明
				</view>
			</view>
			<view class="top_button">
				<view class="top_button_l">
					积分明细 >
				</view>
				<view class="top_button_l">
					兑换记录 >
				</view>
				<view style="width: 1px;height: 60rpx;position: absolute;top: 0;left: 49vw;background: #68adf5;top: 15rpx;"></view>
			</view>
		</view>
		<view style="width: 100vw;height: 100rpx;background: #f2f2f2;padding: 80rpx 30rpx;">
			<span>积分换好物</span>
			<span style="font-size: 22rpx;color: #909399;padding-left: 15rpx;">| 积累节能,兑换好物</span>
		</view>
		<!-- 商品列表 -->
		<view class="guess-section">
			<view 
				v-for="(item, index) in goodsList" :key="index"
				class="guess-item"
				@click="navToDetailPage(item)"
			>
				<view class="image-wrapper">
					<image v-if="item.image" :src="item.image" mode="aspectFill"></image>
					<!-- <image v-else src="@/static/temp/cate13.jpg" ></image> -->
				</view>
				<text class="title clamp">{{item.title}}</text>
				<text class="price">￥{{item.price}}</text>
			</view>
		</view>
	</view>
</template>

<script> 
	export default {
		data() {
			return {
				goodsList: []
			}
		},
		onLoad() {
			// this.loadData();
		},
		methods: {
			// async loadData() {
			// 	let carouselList = await this.$api.json('carouselList');
			// 	// this.titleNViewBackground = carouselList[0].background;
			// 	this.swiperLength = carouselList.length;
			// 	this.carouselList = carouselList;
				
			// 	let goodsList = await this.$api.json('goodsList');
			// 	this.goodsList = goodsList || [];
			// }, 
		}
	} 
</script>

<style lang="scss" scoped>
	.top{
		width: 100vw;
		height: 300rpx;
		background: #1786f8;
		
	}
	.top_avatar{
		width: 90vw;
		margin: 0 auto ;
		padding-top: 50rpx;
		display: flex;
	}
	.illustrate{
		color: #fff;
		font-size: 26rpx;
		padding-top: 40rpx;
	}
	.user-info-box{
		height: 180rpx;
		display:flex;
		align-items:stretch;
		/* position:relative; */
		z-index: 1;
		.portrait{
			width: 120rpx;
			height: 120rpx;
			border:7rpx solid #fff;
			border-radius: 50%;
		}
		.username{
			// font-size: $font-lg + 6rpx;
			color: #fff;
			margin-left: 20rpx;
		}
	}
	.top_button{
		width: 100vw;
		height: 90rpx;
		background: #3895f2;
		display: flex;
		color: #fff;
		position: relative;
	}
	.top_button_l{
		width: 50vw;
		font-size: 28rpx;
		 line-height: 90rpx;
		 text-align: center;
	}
	.guess-section{
		// margin-top: 20rpx;
		display:flex;
		flex-wrap:wrap;
		padding: 0 30rpx 80rpx 30rpx;
		background: #f2f2f2;
		.guess-item{
			background: #fff;
			display:flex;
			flex-direction: column;
			width: 48%;
			padding-bottom: 40rpx;
			margin-bottom: 20rpx;
			&:nth-child(2n+1){
				margin-right: 4%;
			}
		}
		.image-wrapper{
			width: 100%;
			height: 330rpx;
			border-radius: 3px;
			overflow: hidden;
			image{
				width: 100%;
				height: 100%;
				opacity: 1;
			}
		}
		.title{
			// font-size: $font-lg;
			// color: $font-color-dark;
			line-height: 80rpx;
		}
		.price{
			// font-size: $font-lg;
			// color: $uni-color-primary;
			line-height: 1;
		}
	}
</style>
 